<ul class="uk-grid uk-grid-collapse uk-child-width-expand dux-tabs">
    <li class="active">
        <a href="{url('index')}">账户充值</a>
    </li>
    <li class="">
        <a href="{url('log')}">充值记录</a>
    </li>
</ul>
<div class="dux-input-list uk-clearfix">
    <a href="javascript:;" data-money="50" class="active">50元</a>
    <a href="javascript:;" data-money="100">100元</a>
    <a href="javascript:;" data-money="200">200元</a>
    <a href="javascript:;" data-money="500">500元</a>
    <a href="javascript:;" data-money="1000">1000元</a>
    <input type="tel" placeholder="充值金额" id="money" name="money" value="">
</div>
<div class="dux-box">
    <ul class="dux-type-list">
        <?php $i = 0; ?>
        <!--loop{$payList as $type => $vo}-->
        <?php $i++; ?>
        <li>
            <label class="uk-clearfix">
                <div class="uk-float-left">{$vo.name}</div>
                <div class="uk-float-right">
                    <!--if{$i == 1}-->
                    <input class="uk-radio" type="radio" name="type" value="{$type}" checked>
                    <!--{else}-->
                    <input class="uk-radio" type="radio" name="type" value="{$type}">
                    <!--{/if}-->
                </div>
            </label>
        </li>
        <!--{/loop}-->
    </ul>
</div>
<div class="uk-padding-small uk-margin-small-top">
    <button class="uk-button uk-button-primary uk-button-block" type="button" id="pay">确认充值</button>
</div>
<!--if{$offline}-->
<div class="dux-box">
    <div class="box-content">
        线下充值方式:
        <p>
        {$offline}
        </p>
    </div>
</div>
<!--{/if}-->
<script>
    Do('base', function () {
        $('.dux-input-list').on('click', 'a,input', function () {
            $(this).parents('div').find('a,input').removeClass('active');
            $(this).addClass('active');
            if ($(this).data('money')) {
                $('#money').val($(this).data('money'));
            }
        });
        $('#pay').click(function () {
            var money = $('#money').val();
            app.ajax({
                url: '{url()}',
                type: 'post',
                data: {
                    type: $('input[name="type"]:checked').val(),
                    money: money ? money : 50
                },
                success: function (msg, url) {
                    window.location.href = url;
                },
                error: function (msg) {
                    app.error(msg);
                }
            });
        });
    });
</script>
